<template>
	<view class="content">
		<jyf-parser :html="content" ref="article" :tag-style="tagStyle"></jyf-parser>
	</view>
</template>

<script>
	import parser from "@/components/jyf-parser/jyf-parser";
	import { viewContract } from '@/api/car.js';
  
	export default {
		components: {
			"jyf-parser": parser
		},
		data() {
			return {
				tagStyle: {
					img: 'width:100%;display:block;',
					table: 'width:100%',
					video: 'width:100%'
				},
				content: ``,
        id: "",
        type: ""
			}
		},
		onLoad(options) {
      if(options.order_id){
        this.id = options.order_id
      }
      if (options.type) {
        this.type = options.type
      }
      if(options.title){
        uni.setNavigationBarTitle({
          title: options.title
        })
      }
      this.initData()
		},
    methods: {
      initData(){
        viewContract({
          type: this.type || 1, // 1新租售合同 2转租合同
          id: this.id, // 订单id
        }
        ).then(res => {
        	this.content = res.data.content
        }).catch(err => {
        	that.$util.Tips({
        		title: err
        	});
        })
      }
    }
		
	}
</script>

<style scoped>
	page {
		background-color: #fff;
	}

	.content {
		padding: 40rpx 30rpx;
		line-height: 2;
    background: #FFF;
	}
</style>
